const axios = require('axios')
const baseURL = 'http://localhost:3000'

// 获取商品列表
export async function getGoodsList (params) {
  console.log('获取商品列表数据')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/getGoodsList',
    data: {
      ...params
    }
  })
}

// 删除商品
export async function delGoodsByid (params) {
  console.log('获取商品列表数据')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/delGoodsByid',
    data: {
      params
    }
  })
}

// 更新使用优惠券状态
export async function updateCouponState (params) {
  console.log('更新商品优惠券状态')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/updateCouponState',
    data: {
      ...params
    }
  })
}

// 更新商品上架状态
export async function updateGoodsUpperShelfState (params) {
  console.log('更新商品上架状态')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/updateGoodsUpperShelfState',
    data: {
      ...params
    }
  })
}
